swarm-0.7.0.0: data/scenarios/World Examples/clearing.yaml
version: 1
name: Clearing
description: |
The base is in a clearing in the forest: the area within a certain
radius of the base is completely clear of trees; then there are
random trees at increasing density up to another radius; outside of
the outer radius there are only trees.
creative: true
robots:
- name: base
display:
char: Ω
loc: [0, 0]
dir: north
world:
dsl: |
let // Weight the y coordinates used for the radius calculation
// by 2. This will result in an ellipse of half the height,
// which will look circular thanks to the non-square display.
radiussq = x*x + (2*y)*(2*y),
inner = radiussq < 6*6,
outer = radiussq > 30*30,
middle = not inner && not outer
in overlay
[ {dirt}
, mask middle
(let h = hash % 24 in if (36 + h*h) <= radiussq then {tree,dirt} else {dirt})
, mask outer {tree, dirt}
]